package com.saturn.titan.core.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import com.saturn.titan.core.bean.PlatformRole;
import com.saturn.titan.core.repository.mybatis.PlatformRoleDao;

/**
 * 角色服务类
 * @author Administrator
 *
 */
@Component
@Transactional(readOnly = true)
public class RoleService {

	@Autowired
	private PlatformRoleDao platformRoleDao;
	
	public List<PlatformRole> findAllRole(){
		return platformRoleDao.select(new PlatformRole());
	}
	
	public List<PlatformRole> findRolesByEmpId(Long empId){
		return platformRoleDao.findRolesByEmpId(empId);
	}

	@Transactional(readOnly = false)
	public void deleteById(Long id) {
		platformRoleDao.deleteById(id);
	}

	@Transactional(readOnly = false)
	public void add(PlatformRole a) {
		platformRoleDao.insert(a);
	}

	@Transactional(readOnly = false)
	public void deleteNode(Long id) {
		platformRoleDao.deleteById(id);
	}

	@Transactional(readOnly = false)
	public void update(PlatformRole a) {
		platformRoleDao.update(a);
	}

	public List<PlatformRole> findRole(PlatformRole ba) {
		return platformRoleDao.select(ba);
	}
	
}
